package com.suxin;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.quartz.Scheduler;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @Classname SpringTestMain
 * @Description [ TODO ]
 * @Author Tang
 * @Date 2020/11/9 15:45
 * @Created by ASUS
 */
@SpringBootTest(classes = Application.class)
@RunWith(SpringRunner.class)
public class SpringTestMain {

    @Resource
    public SchedulerFactoryBean schedulerFactoryBean;

    @Resource
    ApplicationContext applicationContext;

    @Resource
    public Scheduler scheduler;


    @Test
    public void test02() {



    }


    public static void main(String[] args) {

//        暂停 移除
//        scheduler.pauseTrigger(triggerKey);
//        scheduler.unscheduleJob(triggerKey);
//        scheduler.deleteJob(jobKey);

//        开始任务 恢复暂停
//        scheduler.resumeJob(jobKey);

//        修改 修改定时任务
//        scheduler.rescheduleJob(oldTriggerKey, cronTrigger);

//        新增
//        scheduler.scheduleJob(jobDetail, trigger);

//        立即执行，不等待
//        scheduler.triggerJob(jobKey);

    }

    @Test
    public void test01(){
        Scheduler scheduler = schedulerFactoryBean.getScheduler();

        System.out.println(scheduler);
        System.out.println(this.scheduler);

    }


}